// /////////////////////////////////////////////////////////////////////////////
//
// Name:            SkyDomeComponent.h
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Declaration of the SkyDomeComponent class.
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

#ifndef __SKYDOMECOMPONENT_H__
#define __SKYDOMECOMPONENT_H__

// Include files
#include "../../dependencies.h"
#include "SceneComponent.h"


// SkyDomeComponent class
//! Component wrapper of Irrlicht's SceneManager function addSkyDomeSceneNode(...).
//!
//! <b>XML:</b>
//! \code
//! <SkyDomeComponent>
//!    <!-- Properties -->
//! </SkyDomeComponent>
//! \endcode
//!
class SkyDomeComponent : public SceneComponent
{
public:

    // Initialisation and deinitialisation
    //! Constructor (default)
    //! @param parent        The parent entity to which the component should be added.
    //! @param hRes          Number of vertices of a horizontal layer of the sphere.
    //! @param vRes          Number of vertices of a vertical layer of the sphere.
    //! @param texturePerc   How much of the height of the texture is used. Should be
    //!                      between 0 and 1.
    //! @param spherePerc    How much of the sphere is drawn. Value should be between
    //!                      0 and 2, where 1 is an exact half-sphere and 2 is a full sphere.
    //! @param radius        Radius of the skydome.
    SkyDomeComponent(Entity *parent, u32 hRes = 16, u32 vRes = 8, f32 texturePerc = 0.9f,
                     f32 spherePerc = 2.0f, f32 radius = 1000.0f);
    //! Constructor
    //! @param parent        The parent entity to which the component should be added.
    //! @param fileName      File with the texture to add.
    //! @param hRes          Number of vertices of a horizontal layer of the sphere.
    //! @param vRes          Number of vertices of a vertical layer of the sphere.
    //! @param texturePerc   How much of the height of the texture is used. Should be
    //!                      between 0 and 1.
    //! @param spherePerc    How much of the sphere is drawn. Value should be between
    //!                      0 and 2, where 1 is an exact half-sphere and 2 is a full sphere.
    //! @param radius        Radius of the skydome.
    SkyDomeComponent(Entity *parent, const std::string &fileName, u32 hRes = 16, u32 vRes = 8,
                     f32 texturePerc = 0.9f, f32 spherePerc = 2.0f, f32 radius = 1000.0f);
    //! Constructor
    //! @param parent        The parent entity to which the component should be added.
    //! @param texture       Pointer to the texture to add.
    //! @param hRes          Number of vertices of a horizontal layer of the sphere.
    //! @param vRes          Number of vertices of a vertical layer of the sphere.
    //! @param texturePerc   How much of the height of the texture is used. Should be
    //!                      between 0 and 1.
    //! @param spherePerc    How much of the sphere is drawn. Value should be between
    //!                      0 and 2, where 1 is an exact half-sphere and 2 is a full sphere.
    //! @param radius        Radius of the skydome.
    SkyDomeComponent(Entity *parent, ITexture *texture, u32 hRes = 16, u32 vRes = 8,
                     f32 texturePerc = 0.9f, f32 spherePerc = 2.0f, f32 radius = 1000.0f);
    //! Deconstructor
    ~SkyDomeComponent();

    // Serialization
    //! Serializes this object.
    //! @param attributes
    virtual bool onSerialization(SerializedAttributes *attributes);
    //! Deserializes this object.
    //! @param attributes
    virtual bool onDeserialization(SerializedAttributes *attributes);

private:

    //! Common initialisation method.
    void init(u32 hRes, u32 vRes, f32 texturePerc, f32 spherePerc, f32 radius);
};

#endif
